package com.service;

import com.dao.UserDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * User: Qsxmj
 * Date: 2019/10/9 16:02
 * Content:
 *
 * @author qsxmji
 */
@Service
public class UserService {

    @Autowired
    private UserDAO userDAO;

    /**
     * @param id       用户id
     * @param password 要修改的密码
     * @return
     */
    public int updatePassword(Integer id, String password) {
        return userDAO.updatePasswordById(id, password);
    }

    /**
     * @param id          用户id
     * @param oldPassword 密码
     * @return 验证数据库是是否有该用户时
     */
    public int checkPassword(Integer id, String oldPassword) {
        int n = userDAO.checkPassword(id, oldPassword);
        return n;
    }


}
